<?php

/**
 * Talonario filter form base class.
 *
 * @package    courier
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseTalonarioFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'tal_url'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'tal_factura' => new sfWidgetFormPropelChoice(array('model' => 'Factura', 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'tal_url'     => new sfValidatorPass(array('required' => false)),
      'tal_factura' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Factura', 'column' => 'fac_id')),
    ));

    $this->widgetSchema->setNameFormat('talonario_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Talonario';
  }

  public function getFields()
  {
    return array(
      'tal_id'      => 'Number',
      'tal_url'     => 'Text',
      'tal_factura' => 'ForeignKey',
    );
  }
}
